import React, {Component} from "react";
import News from "./News";
import Message from "./Message";
import MyNaviLink from "../../component/MyNaviLink";
import {Redirect, Route, Switch} from "react-router-dom";

export default class Home extends Component{
    render(){
        return (
            <div>
                <h2>Home内容</h2>
                <div>
                    <ul style={{display:"flex",flexDirection:"row",padding:0}}>
                        <MyNaviLink to="/home/news" style={{marginLeft:8,borderBottom:"1px solid black",padding:4}}>News</MyNaviLink>
                        <MyNaviLink to="/home/message" style={{marginLeft:8,borderBottom:"1px solid black",padding:4}}>Message</MyNaviLink>
                    </ul>
                    <Switch>
                        <Route path="/home/news" component={News}/>
                        <Route path="/home/message" component={Message}/>
                        {/*重定向*/}
                        <Redirect to="/home/news"></Redirect>
                    </Switch>
                </div>

            </div>
        )
    }
}